package top.yvyan.guettable.data;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.tencent.mmkv.MMKV;

import java.util.List;

import top.yvyan.guettable.Gson.ExamScoreNew;
import top.yvyan.guettable.Gson.Semester;
import top.yvyan.guettable.bean.CETBean;
import top.yvyan.guettable.bean.ExamScoreBean;
import top.yvyan.guettable.bean.ExperimentScoreBean;
import top.yvyan.guettable.bean.GradesBean;
import top.yvyan.guettable.bean.PlannedCourseBean;
import top.yvyan.guettable.bean.ResitBean;
import top.yvyan.guettable.bean.SelectedCourseBean;
import top.yvyan.guettable.bean.TermBean;

public class MoreData extends BaseData {
    private static final String MAIN_KEY = "MoreData";
    private static final String EXAM_SCORE_NEW = MAIN_KEY + "EXAM_SCORE_NEW";

    private static final String CREDIT_NEW = MAIN_KEY + "CREDIT_NEW";

    private static final String PLANNED_COURSE_STRING = MAIN_KEY + "plannedCourseString";
    private static final String SELECTED_COURSE = MAIN_KEY + "selectedCourses";
    private static final String SEMESTER_LIST = MAIN_KEY + "semester_list";
    private static final String CURRENT_SEMESTER = MAIN_KEY + "current_semester";

    //计划课程
    public static List<PlannedCourseBean> getPlannedCourseBeans() {
        return getList(PLANNED_COURSE_STRING, new TypeToken<List<PlannedCourseBean>>() {
        }.getType());
    }

    public static void setPlannedCourseBeans(List<PlannedCourseBean> plannedCourseBeans) {
        set(PLANNED_COURSE_STRING, plannedCourseBeans);
    }

    //已选课程
    public static List<SelectedCourseBean> getSelectedCourseBeans() {
        return getList(SELECTED_COURSE, new TypeToken<List<SelectedCourseBean>>() {
        }.getType());
    }

    public static void setSelectedCoursesBeans(List<SelectedCourseBean> selectedCoursesBeans) {
        set(SELECTED_COURSE, selectedCoursesBeans);
    }

    public static GradesBean getGradesBean() {
        return get(CREDIT_NEW,GradesBean.class);
    }

    public static ExamScoreNew getExamScoreNew() {
        return get(EXAM_SCORE_NEW, ExamScoreNew.class);
    }

    public static void setGradesBean(GradesBean gradesBean) {
        set(CREDIT_NEW,gradesBean);
    }

    public static void setExamScoreNew(ExamScoreNew examScoreNew) {
        set(EXAM_SCORE_NEW, examScoreNew);
    }

    public static void setSemesterList(List<Semester> semesters) {
        set(SEMESTER_LIST, semesters);
    }

    public static List<Semester> getSemesterList() {
        return getList(SEMESTER_LIST,new TypeToken<List<Semester>>() {}.getType());
    }

    public static void setSemester(Semester semester) {
        set(CURRENT_SEMESTER,semester);
    }

    public static Semester getSemester() {
        return get(CURRENT_SEMESTER,Semester.class);
    }
}
